/**
 * 
 */
package org.lex.swing.plaf.widget;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JRadioButtonMenuItem;
import javax.swing.LookAndFeel;

import org.lex.swing.plaf.util.LookAndFeelUtils;

public class LookAndFeelRadioMenuItem extends JRadioButtonMenuItem implements ActionListener {
	private LookAndFeel lnf = null;
	private Component[] components = null;

	public LookAndFeelRadioMenuItem(LookAndFeel lnf) {
		super(lnf.getName());
		this.lnf = lnf;
		this.addActionListener(this);
		this.setSelected(false);
	}

	public LookAndFeelRadioMenuItem(LookAndFeel lnf, Component... cs) {
		this(lnf);
		this.components = cs;
	}

	public void actionPerformed(ActionEvent e) {
		if (false == this.isSelected())
			return;
		LookAndFeelUtils.updateAllComponentsLookAndFeel(lnf, components);
	}
}
